import request from '@/utils/request'

// 获取组织架构的数据
export function getDepartList() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

/**
 * 删除部门数据接口定义
 */
export function delDepartApi(id) {
  return request({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}

/**
 * 新增部门接口
 * @param {{code: string, introduce: string, manager: string, pid: string, name: string}} data 新增部门数据
 * @return {*}
 */
export function addDepartApi(data) {
  return request({
    method: 'POST',
    url: '/company/department',
    data
  })
}

/** *
 * 获取部门详情
 * ***/
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

/*
* 编辑部门接口
* */

export function updateDepartsApi(data) {
  return request({
    method: 'PUT',
    url: `/company/department/${data.id}`,
    data
  })
}
